package com.example.springbootexcle.service.impl;

import com.example.springbootexcle.model.User;
import com.example.springbootexcle.reposity.UserReposity;
import com.example.springbootexcle.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserReposity reposity;

    /**
     * 查询所有数据
     * @return
     */
    @Override
    public List<User> selectAll() {
        return reposity.findAll();
    }

    /**
     * 批量添加
     * @param list
     */
    @Override
    public void adds(List<User> list) {
        reposity.saveAll(list);
    }

}
